﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Redirecting...</title>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link rel=stylesheet href="../css-layouts/themes/defaulttheme.css" type="text/css">

</head>

<?php 

 require_once("../sqlconfig.php");

 mysql_connect($server, $sqlusr, $sqlpass) or die(mysql_error());
 mysql_select_db($mydb) or die(mysql_error()); 
 
 //Checks if there is a login cookie
 if(isset($_COOKIE["parentinformerprcshs"])) { 
 $username = $_COOKIE["parentinformerprcshs"]; 
 $pass = $_COOKIE["parentinformerurcshs"];
 $check = mysql_query("SELECT * FROM logtbl WHERE usernm = '".$username."'") or die(mysql_error());
 while($info=mysql_fetch_array($check)) {
  if ($pass!=$info['pwrnd']) {
   header("Location: logerr_atmpt.php");
  }
  else {
 
?>

<body>

<div class="bgredir redirin">

<p class="textwrapredir">

Thank you for logging in, <b><?php echo $_COOKIE["parentinformerprcshs"] ?></b>!
<br><br>
You will be redirected to the Main Lobby in <span id="timectr">5</span> second<span id="spluralize">s</span>.
<br><br>
<img src="../img/themes/default/loader.gif" alt="Circle Loader">
<br><br>
<em><a href="../">Skip</a> to Main Lobby.</em>

</p>

</div>

<script type="text/javascript">
<!--

var redirecturl = "../";
var timedelay = 5;

// CODE! :D

function redirme() {
 if (timetoredir) {
  clearInterval(timetoredir);
 }
 window.location = redirecturl;
}

function changetime() {
 ctrin = document.getElementById("timectr").innerHTML;
 ctrin--;
 timedelay--;
 document.getElementById("timectr").innerHTML = ctrin;

 if(timedelay < 2) {
  document.getElementById("spluralize").innerHTML = "";
 }

 if(timedelay == 0) {
  redirme();
 }

}

var timetoredir = setInterval("changetime()", 1000);

//-->
</script>

</body>

<?php

   }
  }
 }
 else {
  header("Location: ../index.php");
 }

?>

</html>